home *** CD-ROM | disk | FTP | other *** search
/ Total Network Tools 2002 / NextStepPublishing-TotalNetworkTools2002-Win95.iso / Archive / Web Server / TinyWeb Server.EXE / CGITEST.ZIP / LOGIN.C < prev    next >
Encoding:
C/C++ Source or Header  |  1999-04-30  |  1.0 KB  |  52 lines

  1. //////////////////////////////////////////////////////////////////////////
  2. //
  3. //  CGI Testing Example
  4. //
  5. //  Copyright (C) 1997 RIT Research Labs
  6. //
  7. //////////////////////////////////////////////////////////////////////////
  8.  
  9.  
  10.  
  11. #include <stdio.h>
  12. #include <windows.h>
  13.  
  14. void main(void)
  15. {
  16.  
  17.   HANDLE StdIn;
  18.   int Size, Actual;
  19.   char* String;
  20.  
  21.  
  22.   StdIn = GetStdHandle(STD_INPUT_HANDLE);
  23.  
  24. ///////////////////
  25.  
  26.   Size = SetFilePointer(StdIn, 0, NULL, FILE_END);
  27.   SetFilePointer(StdIn, 0, NULL, FILE_BEGIN);
  28.  
  29. ///////////////////
  30. //
  31. // Note that getting size of data available in StdIn via SetFilePointer()
  32. // works under WinNT only. Under Win9x, you should get the size from
  33. // CONTENT_LENGTH environment variable.
  34. //
  35. ///////////////////
  36.  
  37.  
  38.   String = malloc(Size+1);
  39.   if (Size <= 0) return;
  40.  
  41.   ReadFile(StdIn, String, Size, &Actual, NULL);
  42.  
  43.   String[Size] = 0;
  44.  
  45.   printf("Content-Type: text/plain\n\n");
  46.  
  47.   printf("%s\n\n", String);
  48.  
  49.   printf("This means nothing except TinyWeb CGI works\n");
  50.  
  51. }
  52.